﻿/*********************************************************************************
**                                                                              **
**  Copyright (C) 2021-2025 LiLong                                              **
**  This file is part of CommonUnits.                                           **
**                                                                              **
**  CommonUnits is free software: you can redistribute it and/or modify         **
**  it under the terms of the GNU Lesser General Public License as published by **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  CommonUnits is distributed in the hope that it will be useful,              **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU Lesser General Public License for more details.                         **
**                                                                              **
**  You should have received a copy of the GNU Lesser General Public License    **
**  along with CommonUnits.  If not, see <https://www.gnu.org/licenses/>.       **
**********************************************************************************/
#pragma once

#include "../CommonUnits.h"
#include "../UnitLists.h"

namespace CU
{
inline namespace Capacitance
{
namespace Units
{
using F  = StandardUnit<"F">;
using mF = DeriveUnit<F, "mF", std::milli>;
using uF = DeriveUnit<F, "μF", std::micro>;
using nF = DeriveUnit<F, "nF", std::nano>;
using pF = DeriveUnit<F, "pF", std::pico>;
using fF = DeriveUnit<F, "fF", std::femto>;
using aF = DeriveUnit<F, "aF", std::atto>;
using kF = DeriveUnit<F, "kF", std::kilo>;
using MF = DeriveUnit<F, "MF", std::mega>;
using GF = DeriveUnit<F, "GF", std::giga>;
using TF = DeriveUnit<F, "TF", std::tera>;
using PF = DeriveUnit<F, "PF", std::peta>;
using EF = DeriveUnit<F, "EF", std::exa>;

using CapacitanceList = UnitLists<aF, fF, pF, nF, uF, mF, F, kF, MF, GF, TF, PF, EF>;
} // namespace Units
using Farad      = CommonUnits<double, Units::F>;
using Millifarad = CommonUnits<double, Units::mF>;
using Microfarad = CommonUnits<double, Units::uF>;
using Nanofarad  = CommonUnits<double, Units::nF>;
using Picofarad  = CommonUnits<double, Units::pF>;
using Femtofarad = CommonUnits<double, Units::fF>;
using Attofarad  = CommonUnits<double, Units::aF>;
using Kilofarad  = CommonUnits<double, Units::kF>;
using Megafarad  = CommonUnits<double, Units::MF>;
using Gigafarad  = CommonUnits<double, Units::GF>;
using Terafarad  = CommonUnits<double, Units::TF>;
using Petafarad  = CommonUnits<double, Units::PF>;
using Exafarad   = CommonUnits<double, Units::EF>;
namespace Literals
{
inline namespace CapacitanceLiterals
{
constexpr Farad operator"" _F(long double value) { return Farad(static_cast<double>(value)); }
constexpr Farad operator"" _F(unsigned long long value) { return Farad(static_cast<double>(value)); }
constexpr Millifarad operator"" _mF(long double value) { return Millifarad(static_cast<double>(value)); }
constexpr Millifarad operator"" _mF(unsigned long long value) { return Millifarad(static_cast<double>(value)); }
constexpr Microfarad operator"" _uF(long double value) { return Microfarad(static_cast<double>(value)); }
constexpr Microfarad operator"" _uF(unsigned long long value) { return Microfarad(static_cast<double>(value)); }
constexpr Nanofarad operator"" _nF(long double value) { return Nanofarad(static_cast<double>(value)); }
constexpr Nanofarad operator"" _nF(unsigned long long value) { return Nanofarad(static_cast<double>(value)); }
constexpr Picofarad operator"" _pF(long double value) { return Picofarad(static_cast<double>(value)); }
constexpr Picofarad operator"" _pF(unsigned long long value) { return Picofarad(static_cast<double>(value)); }
constexpr Femtofarad operator"" _fF(long double value) { return Femtofarad(static_cast<double>(value)); }
constexpr Femtofarad operator"" _fF(unsigned long long value) { return Femtofarad(static_cast<double>(value)); }
constexpr Attofarad operator"" _aF(long double value) { return Attofarad(static_cast<double>(value)); }
constexpr Attofarad operator"" _aF(unsigned long long value) { return Attofarad(static_cast<double>(value)); }
constexpr Kilofarad operator"" _kF(long double value) { return Kilofarad(static_cast<double>(value)); }
constexpr Kilofarad operator"" _kF(unsigned long long value) { return Kilofarad(static_cast<double>(value)); }
constexpr Megafarad operator"" _MF(long double value) { return Megafarad(static_cast<double>(value)); }
constexpr Megafarad operator"" _MF(unsigned long long value) { return Megafarad(static_cast<double>(value)); }
constexpr Gigafarad operator"" _GF(long double value) { return Gigafarad(static_cast<double>(value)); }
constexpr Gigafarad operator"" _GF(unsigned long long value) { return Gigafarad(static_cast<double>(value)); }
constexpr Terafarad operator"" _TF(long double value) { return Terafarad(static_cast<double>(value)); }
constexpr Terafarad operator"" _TF(unsigned long long value) { return Terafarad(static_cast<double>(value)); }
constexpr Petafarad operator"" _PF(long double value) { return Petafarad(static_cast<double>(value)); }
constexpr Petafarad operator"" _PF(unsigned long long value) { return Petafarad(static_cast<double>(value)); }
constexpr Exafarad operator"" _EF(long double value) { return Exafarad(static_cast<double>(value)); }
constexpr Exafarad operator"" _EF(unsigned long long value) { return Exafarad(static_cast<double>(value)); }
} // namespace CapacitanceLiterals
} // namespace Literals
template<typename Unit>
inline auto toUnit(double value, const std::string& dest) -> Unit
{
    return toUnitHelper<Unit, Units::CapacitanceList>(value, dest);
}
} // namespace Capacitance
} // namespace CU